package com.jxwifi.cloud.quickclean.adapter;

import android.support.annotation.LayoutRes;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jxwifi.cloud.quickclean.R;
import com.jxwifi.cloud.quickclean.bean.SysDicBean;

/**
 * Created by Administrator on 2019/6/11.
 */

public class ConplaintAdapter extends BaseQuickAdapter<SysDicBean, BaseViewHolder> {

    public ConplaintAdapter(@LayoutRes int layoutResId) {
        super(layoutResId, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, SysDicBean item) {
        helper.setText(R.id.tv_list_complaint_item_title,item.getCodeText());
        helper.addOnClickListener(R.id.rel_list_complaint_item);
    }

    /* private Context mContext;
    private List<String> mList = new ArrayList<>();

    public ConplaintAdapter(Context ctx) {
        mContext = ctx;
    }

    *//**
     * 下拉刷新时调用
     *
     * @param list
     *//*
    public void refresh(List<String> list) {
        mList.clear();
        addData(list);
    }

    public void updata() {
        mList.clear();
        notifyDataSetChanged();
    }

    //添加数据
    public void addData(List<String> list) {
        if (list.size() != 0 || list != null) {
            mList.addAll(list);
            notifyDataSetChanged();
        }
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.list_complaint_item, null);
        return new ViewHolder(view);
    }


    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        final ViewHolder mViewHolder = (ViewHolder) holder;
        //final OrderFromBean mAskBean = mList.get(position);
        mViewHolder.mRelListComplaintItem.setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                Intent intent=new Intent();
                intent.setClass(mContext,ComplaintDetailsActivity.class);
                mContext.startActivity(intent);
            }
        });
    }

    class ViewHolder extends RecyclerView.ViewHolder {
        View mContainer;
        *//*TextView mTvMyOrderItemState;//状态
        TextView mTvMyOrderItemPrice;//价格
        TextView mTvMyOrderItemTimeText;//时间
        TextView mTvMyOrderItemAddressText;//地址
        RelativeLayout mRelMyOrderItem;*//*
        RelativeLayout mRelListComplaintItem;


        public ViewHolder(View itemView) {
            super(itemView);
            mContainer = itemView;
           *//* mTvMyOrderItemState = (TextView) itemView.findViewById(R.id.tv_my_order_item_state);
            mTvMyOrderItemPrice = (TextView) itemView.findViewById(R.id.tv_my_order_item_price);
            mTvMyOrderItemTimeText = (TextView) itemView.findViewById(R.id.tv_my_order_item_time_text);
            mTvMyOrderItemAddressText = (TextView) itemView.findViewById(R.id.tv_my_order_item_address_text);
            mRelMyOrderItem=(RelativeLayout)itemView.findViewById(R.id.rel_my_order_item);*//*
            mRelListComplaintItem=(RelativeLayout)itemView.findViewById(R.id.rel_list_complaint_item);
        }
    }*/
}
